import logging
import os
import pytest
import sys
from utils.send_message import send_message

if __name__ == "__main__":

    if len(sys.argv)==2:
        env = sys.argv[1]
        if env not in ["prod","sting","test"]:
            logging.error("传入的环境变量参数错误，应该是['prod','sting','test']")
    else:
        env = "prod"


    pytest.main(["-vs","./testcases/test_management.py","--alluredir","./report/json_report","--clean-alluredir",f"--env={env}"])
    os.system("allure generate ./report/json_report -o ./report/html_report --clean")
    send_message(env)